ποΈGitΠ―ΡΠ°ποΈ
docs/en/developer/testing.md 936be3998f0fe49f58b8a0f9ff2c01e3cbd85609 (936be399) Text, 2.58 KB
title: Testing
parent: Developer Guide
nav_order: 7
last_updated: 2026-05-13
aliases:
β’ tests
β’ unit-tests
β’ screenshot-tests
Testing
Testing strategy and practices for the Meshtastic KMP project.
Test Categories
KMP Unit Tests (T383838commonTest)
Shared tests that run on all platforms:
T282828
./gradlew allTests
β’ Business logic tests
β’ Data model validation
β’ Search/ranking algorithm tests
β’ Route serialization tests
Android Host Tests
Android-specific tests that run on JVM:
T282828
./gradlew Tffa657test
β’ ViewModel tests
β’ Repository tests with Room fakes
β’ Android-specific integration tests
Compose UI Tests
Compose Multiplatform UI test framework:
T282828
Tf0883e@Test
Tff7b72fun Td2a8ffmyScreenTestTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Te6edf3setContent Tb4b4b4{ Te6edf3MyScreenTb4b4b4(Tb4b4b4) Tb4b4b4}
Te6edf3onNodeWithTextTb4b4b4(Ta5d6ff"Ta5d6ffExpectedTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Tb4b4b4}
Located in T383838commonTest or T383838jvmTest source sets.
Screenshot Tests
Uses Android Gradle Plugin's native screenshot testing framework:
T282828
./gradlew :screenshot-tests:updateDebugScreenshotTest T8b949e# Record golden images
./gradlew :screenshot-tests:validateDebugScreenshotTest T8b949e# Compare against goldens
./gradlew :screenshot-tests:copyDocsScreenshots T8b949e# Copy reference images to docs pipeline
Test Organization
T282828
feature/my-feature/src/
βββ commonTest/kotlin/org/meshtastic/feature/myfeature/
β βββ MyBusinessLogicTest.kt
β βββ MyModelTest.kt
βββ jvmTest/kotlin/org/meshtastic/feature/myfeature/
βββ MyDesktopSpecificTest.kt
Testing Guidelines
DO
β’ Write tests in T383838commonTest when possible (runs everywhere)
β’ Test business logic independently from UI
β’ Use fakes/stubs instead of mocks where practical
β’ Test edge cases: empty states, error states, boundary values
β’ Test deep link routing in T383838DeepLinkRouterTest
β’ Keep tests fast β no network, no disk I/O in unit tests
DON'T
β’ Don't test framework behavior (Compose internals, Room queries)
β’ Don't create tests that depend on other feature modules
β’ Don't use T383838Thread.sleep β use coroutine test dispatchers
β’ Don't rely on test execution order
Running Tests
T282828
T8b949e# All KMP tests
./gradlew allTests
T8b949e# Specific module
./gradlew :feature:docs:allTests
T8b949e# Code quality
./gradlew spotlessCheck detekt
T8b949e# Full verification
./gradlew spotlessCheck detekt kmpSmokeCompile Tffa657test allTests
CI Integration
Tests run automatically on:
β’ Pull request creation/update
β’ Push to T383838main
β’ Pre-release validation
The CI workflow uses T383838ubuntu-24.04 with JDK 21 and Gradle caching.
Served by rngit 1.5.0 - Generated in 0.04s